home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / GUI_LIB.ZIP / GUI_LIB@.EXE / GUI_LIB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-08  |  7.1 KB  |  355 lines

  1. #include <dos.h>
  2. #include <dos.h>
  3. #include <string.h>
  4. #include <alloc.h>
  5. #include <stdarg.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <graphics.h>
  9. #include <conio.h>
  10. #include <values.h>
  11. #include <ctype.h>
  12.  
  13. #define TRUE 1
  14. #define FALSE 0
  15. #define IN 0
  16. #define OUT 1
  17. #define THICK 0
  18. #define THIN 1
  19. #define TEXT 0
  20. #define IMAGE 1
  21.  
  22. typedef struct {
  23.         int m1,m2,m3,m4;
  24.         } mparams;
  25. void mouse(mparams *p);
  26. extern int _Cdecl button;
  27. extern int _Cdecl status;
  28. extern int _Cdecl count;
  29. extern int _Cdecl xpos;
  30. extern int _Cdecl ypos;
  31.  
  32. int mouse_init(void);
  33. void show_cursor(void);
  34. void hide_cursor(void);
  35. void get_status(int *button, int *curx, int *cury);
  36. void pos_mouse(int x, int y);
  37. void b_press(int btn, int *bnow, int *bcount, int *x, int *y);
  38. void sethbounds(int l, int r);
  39. void setvbounds(int t, int b);
  40. void setgraphics(int hspot, int vspot, void far *cmask);
  41. void setspeed(int x, int y);
  42. void set_threshold(int);
  43. void set_subroutine(int,void (far *)(void));
  44. void b_release(int,int *,int *,int *,int *);
  45. void settext(int,int,int);
  46. void motion(int *,int *);
  47. void light_pen(int);
  48. void conditional_off(int,int,int,int);
  49. int leftmousekeypressed();
  50. int rightmousekeypressed();
  51.  
  52. //************************************************************************
  53.  
  54. class Point
  55. {
  56.   protected:
  57.     int x,y,color;
  58.     viewporttype vref;
  59.   public:
  60.     Point();
  61.     void move(int ptx,int pty);
  62.     virtual void draw();
  63.     void create(int ptx,int pty,int c);
  64.     void restoreviewport();
  65.     void Setcolor(int c);
  66.     virtual void setloc(int ptx,int pty);
  67.     virtual void erase();
  68.     int Getcolor();
  69.     int Getx();
  70.     int Gety();
  71. };
  72.  
  73. //************************************************************************
  74.  
  75. class Colorbutton:public Point
  76. {
  77.     protected:
  78.         int color;
  79.         int width;
  80.         int height;
  81.     public:
  82.         void init(int,int,int,int,int);
  83.         void show(int);
  84.         int  hit();
  85.         int getcolor();
  86. };
  87.  
  88. //************************************************************************
  89.  
  90. class Icon:public Point
  91. {
  92.     protected:
  93.         int state;
  94.     public:
  95.         void far *picture;
  96.         Icon();
  97.         ~Icon();
  98.         void init(int,int,char*);
  99.         void show();
  100.         void choose();
  101.         int hit();
  102.         int ispressed();
  103. };
  104.  
  105. //************************************************************************
  106.  
  107. class Acticon:public Icon
  108. {
  109.     protected:
  110.         void *picture[32];
  111.         int state;
  112.         int numpix;
  113.     public:
  114.         Acticon();
  115.         ~Acticon();
  116.         void init(int,int,char*);
  117.         void show(int);
  118.         void choose();
  119.         int ispressed();
  120.         void animate(int);
  121.         void backforth(int);
  122. };
  123.  
  124. //************************************************************************
  125.  
  126. class Button:public Point
  127. {
  128.   protected:
  129.     int state,sizex,sizey;
  130.     char btntxt[40];
  131.     int  file_text;
  132.     void *picture;
  133.     void getpic(char*);
  134.   public:
  135.     Button();
  136.     ~Button();
  137.     virtual void show();
  138.     virtual void press();
  139.     void init(int ptx,int pty,char* text,int);
  140.     virtual void erase();
  141.     virtual void move(int ptx,int pty);
  142.     void setstate(int bstate);
  143.     void invert();
  144.     int hit();
  145. };
  146.  
  147. //************************************************************************
  148.  
  149. class Panel:public Point
  150. {
  151.     protected:
  152.         int w;
  153.         int h;
  154.         int in_or_out;
  155.         int thick_or_thin;
  156.     public:
  157.         Panel();
  158.         ~Panel();
  159.         virtual void show();
  160.         void init(int,int,int,int,int,int);
  161. };
  162.  
  163.  
  164. //************************************************************************
  165.  
  166. class Bevel:public Point
  167. {
  168.     private:
  169.         int w;
  170.         int h;
  171.         int thick_or_thin;
  172.         Panel outerbevel;
  173.         Panel innerbevel;
  174.     public:
  175.         void init(int,int,int,int,int);
  176.         virtual void show();
  177. };
  178.  
  179. //************************************************************************
  180.  
  181. typedef char gitemarray[80][10];
  182.  
  183. class Gmenu {
  184.       protected:
  185.         int on;
  186.         int x,y,w,h;
  187.         int num;
  188.         gitemarray gitems;
  189.         int menuchoice;
  190.         int oldbarx,oldbary;
  191.         void *ptr;
  192.         void *menubar;
  193.       public:
  194.         Gmenu();
  195.         ~Gmenu();
  196.         void init(int xloc,int yloc,int numentries,
  197.                gitemarray gitem);
  198.         int show();
  199.         void hide();
  200.         int isshown();
  201. };
  202.  
  203. //************************************************************************
  204.  
  205. class Gmenubutton {
  206.         protected:
  207.           int on;
  208.           int x,y;
  209.           int offfgd,offbgd;
  210.           int onfgd,onbgd;
  211.           char id[20];
  212.         public:
  213.           Gmenubutton();
  214.           ~Gmenubutton();
  215.           void init(int xloc,int yloc,int ffgd,int fbgd,
  216.                 int nfgd,int nbgd,char txt[20]);
  217.           void show();
  218.           void press();
  219.           int hit();
  220. };
  221.  
  222. //************************************************************************
  223.  
  224. void gprintf(int xloc,int yloc,char *fmt,...);
  225. void gprintc(int xloc, int yloc, char *fmt,...);
  226. void gprintxy(int xloc,int yloc,char *fmt,...);
  227.  
  228. //************************************************************************
  229.  
  230. class Tstring {
  231.     protected:
  232.         char laststring[81];
  233.         char bar[81];
  234.         int xpos;
  235.         int x;
  236.         int y;
  237.         int length;
  238.         int ucase;
  239.         int escape;
  240.         int retrn;
  241.         int tab;
  242.         int uparrow;
  243.         int dnarrow;
  244.         int shown;
  245.         int barred;
  246.         int firstchar;
  247.         int infgd;
  248.         int inbgd;
  249.     public:
  250.         Tstring();
  251.         ~Tstring();
  252.         void init(int xloc,int yloc,int len,int uppercase);
  253.         void show();
  254.         void input();
  255.         void get_input();
  256.         void get_form_input();
  257.         void get_form_mouse_input();
  258.         void reset();
  259.         void preset(char *);
  260.         void erase(int);
  261.         char *getstring();
  262.         int escapehit();
  263.         int returnhit();
  264.         int tabhit();
  265.         int uparrowhit();
  266.         int dnarrowhit();
  267.         int isshown();
  268.         int isbarred();
  269.         int hit();
  270.         void setincolors(int,int);
  271. };
  272.  
  273. //*************************************************************************
  274.  
  275. class Gstring:public Tstring {
  276.     protected:
  277.         int curpos;
  278.         int curson;
  279.         void showcurs();
  280.         void hidecurs();
  281.     public:
  282.         void init(int,int,int,int);
  283.         void show();
  284.         void input();
  285.         void get_input();
  286.         void get_form_input();
  287.         void reset();
  288.         int isshown();
  289.         void check_for_blink();
  290.         };
  291.  
  292. //************************************************************************
  293.  
  294. void vprintat(int cols,int rows,int fore,int back,char *,...);
  295. void vprintc(int row,int fore,int back,char *,...);
  296. void printat(int,int,int,int,char *);
  297. void printc(int,int,int,char *);
  298. void cprintat(int,int,int,int,char *,...);
  299. void cprintc(int,int,int,char *,...);
  300. void clear(char ch,int fore,int back);
  301. void cursoroff();
  302. void cursoron();
  303. void settext(int,int);
  304. void chsattr(int,int);
  305. void chcattr(int,int,int,int,int);
  306. void dlay(int ticks);
  307. long getticks();
  308. int altkey();
  309. int ctrlkey();
  310. int lshiftkey();
  311. int rshiftkey();
  312. void flushkeys();
  313. unsigned char getvidmode();
  314.  
  315. #define ALTA 30
  316. #define ALTB 48
  317. #define ALTC 46
  318. #define ALTD 32
  319. #define ALTE 18
  320. #define ALTF 33
  321. #define ALTG 34
  322. #define ALTH 35
  323. #define ALTI 23
  324. #define ALTJ 36
  325. #define ALTK 37
  326. #define ALTL 38
  327. #define ALTM 50
  328. #define ALTN 49
  329. #define ALTO 24
  330. #define ALTP 25
  331. #define ALTQ 16
  332. #define ALTR 19
  333. #define ALTS 31
  334. #define ALTT 20
  335. #define ALTU 22
  336. #define ALTV 47
  337. #define ALTW 17
  338. #define ALTX 45
  339. #define ALTY 21
  340. #define ALTZ 44
  341.  
  342. #define ALT1 120
  343. #define ALT2 121
  344. #define ALT3 122
  345. #define ALT4 123
  346. #define ALT5 124
  347. #define ALT6 125
  348. #define ALT7 126
  349. #define ALT8 127
  350. #define ALT9 128
  351. #define ALT0 129
  352.  
  353. #define ALTMINUS  130
  354. #define ALTPLUS   131
  355.